﻿using UnityEngine;
using Entitas;
public class MasterController : MonoBehaviour
{
    Contexts contexts;
    Systems systems;
    void Start()
    {
        contexts = Contexts.sharedInstance;
        systems = CreateSystems(contexts);
        systems.Initialize();
        
    }

    void Update()
    {
        systems.Execute();
        systems.Cleanup();
    }

    private void OnDestroy()
    {
        systems.TearDown();
    }
    private Systems CreateSystems(Contexts contexts)
    {
        return new Feature("Systems")
          .Add(new PlayerFeatures(contexts))
          .Add(new AnimationFeatures(contexts))
          .Add(new CollisionFeatures(contexts))
          .Add(new EnemyFeatures(contexts));


    }
}